package com.xiu.json;

/**
 * @Author: tjc
 * @description
 * @Date Created in 18:34 2022-04-16
 */
public class String2Num {
    public static void main(String[] args) {
        String str = "9999998999999999999999999999999999999999999999999999999999999999999999999999.99999";
        boolean point = str.contains(".");
        Number num;
        try {
            if (point)
                num = Float.valueOf(str);
            else
                num = Integer.valueOf(str);
        } catch (NumberFormatException e) {
            num = Long.valueOf(str);
        }

        System.out.println(num.getClass().getName());
        System.out.println(num);
    }
}
